<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="yes" name="apple-touch-fullscreen"/>
    <meta content="telephone=no" name="format-detection"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
	<title>Genius Bear</title>
	<link rel="stylesheet" type="text/css" href="./styles/main.css">
	<script type="text/javascript" src="./bower_components/jquery/dist/jquery.min.js"></script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
		<script type="text/javascript" src="./scripts/BA_statistic.js"></script>

</head>
<body>
	<div class="welcome-container">
		<main>
			<div>
				<img src="./images/logo_bear3.png" width="40%">
			</div>
			<div>
				<img src="./images/logo_title.png" width="40%">
			</div>
			<div class="point-box">
				<div class="point-title">
					测试得分
				</div>
				<div class="point-number result">
					0
				</div>
				<p class="result-tip text-formal"></p>
				<p class="text-formal">恭喜您的宝宝！<br/>在PK中取得了<span class="text-important result"></span>分的成绩！<br/>战胜了全国<span class="text-important result-percent">0%</span>的小朋友！</p>
				<p class="text-important share"><a href="#">分享到朋友圈与其他小朋友比一比</a></p>
			</div>
			<div class="text-formal contact-box"><img src="./images/logo_text.png" width="80px">将免费为您的宝宝提供<br/>
				<ul>
				<li>1. 幼儿思维发展测评1次</li>
				<li>2. 天才熊脑力开发课程体验1次</li>
				<li>3. 天才熊大礼包1份</li>
			</div>
			<div class="text-result">
				<p>请留下您的联系方式，欢迎您进店咨询</p>
				<div class="form-group-sm">
					<label for="inputName">姓名</label>
					<input id="inputName" name="name" type="text">
				</div>
				<div class="form-group-sm">
					<label for="inputPhone">电话</label>
					<input id="inputPhone" name="phone" type="phone">
				</div>
			</div>
			<div class="result-submit">
				<a href="javascript:;" onclick="submit()">
					<img src="./images/cube.png" width="10%">
				</a>
			</div>
			<p>点击魔方 提交信息</p>
		</main>
	</div>
	<footer class="ext-footer">
		<div class="about-box clearfix">
			<div class="code-side">
				<img src="./images/code.png" width="100px">
				<div><small>扫描公众账号，直接预约</small></div>
			</div>
			<h2>联系我们</h2>
			<p>西安天才熊幼儿成长中心</p>
			<p>地址：莲湖区劳动南路大唐西市时尚生活馆2F</p>
			<p>联系电话：029-81338866</p>
		</div>
		<div class="about-bottom">
			<img src="./images/logo_title.png" width="120px">
			<img src="./images/logo_bear3.png" width="80px">
		</div>
	</footer>

	<script type="text/javascript">
		var point = -1;

		$(function () {
			var param = window.location.search.substr(1).match(/(^|&)point=([^&]*)(&|$)/);
			if (param) {
				point = parseInt(param[2]);
			}
			if (point === -1) {
				window.location.href = './info.html';
				return;
			}
			$('.result').text(point);
			var percent = 0;
			var tip = '粗心了吧？';

			if (point > 0 && point < 10) {
				percent = 0;
				tip = '粗心了吧？';
			} else if (point >= 10 && point < 20) {
				percent = 24;
				tip = '粗心了吧？';
			} else if (point >= 20 && point < 30) {
				percent = 50;
				tip = '粗心了吧？';
			} else if (point >= 30 && point < 40) {
				percent = 67;
				tip = '表现不错哦！';
			} else if (point >= 40 && point < 50) {
				percent = 78;
				tip = '表现不错哦！';
			} else if (point >= 50 && point < 60) {
				percent = 85;
				tip = '表现不错哦！';
			} else if (point >= 60 && point < 70) {
				percent = 91;
				tip = '已经很棒啦！';
			} else if (point >= 70 && point < 80) {
				percent = 94;
				tip = '已经很棒啦！';
			} else if (point >= 80 && point < 90) {
				percent = 96;
				tip = '已经很棒啦！';
			} else if (point >= 90 && point < 100) {
				percent = 98;
				tip = '已经很棒啦！';
			} else if (point == 100) {
				percent = 99;
				tip = '天才出现啦！';
			}

			$('.result-percent').text(percent + '%');
			$('.result-tip').text(tip);
 		});

		function submit() {
			if (!$('#inputName').val() || !$('#inputName').val()) {
				alert('必须填写姓名和电话！');
				return false;
			}

			$.ajax({
				url: './save.php',
				data: {
					name: $('#inputName').val(),
					phone: $('#inputPhone').val(),
					age: sessionStorage.age || 0,
					gender: sessionStorage.gender || 0,
					answers: sessionStorage.answers || '',
					points: point
				},
				type: 'POST',
				success: function (res) {
					window.location.href = './about.html';
				},
				error: function (e) {

				}
			});
		}

	    
	</script>
	<script type="text/javascript" src="./scripts/wx_share.js"></script>
</body>
</html>